package com.yatang.yiliao.app.adapters;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by Yatang Software on 2015/4/28.
 */
public class FragmentAdapter extends FragmentPagerAdapter {

    List<Fragment> fragmentList;

    public FragmentAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.fragmentList = fragments;
    }

    @Override
    public Fragment getItem(int i) {
        Fragment ret = null;
        if (fragmentList != null) {
            ret = fragmentList.get(i);
        }
        return ret;
    }

    @Override
    public int getCount() {
        int count = 0;
        if (fragmentList != null) {
            count = fragmentList.size();
        }
        return count;
    }
}
